#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
using namespace std;

const int N = 1e5 + 10;
int n, k;
int a[N];

int main()
{
    cin >> n >> k;
    priority_queue<int, vector<int>, greater<int>> heap;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        heap.push(a[i]);
    }
    int sum = 0, day = 0;
    while (true)
    {
        int t = heap.top();
        heap.pop();
        sum += t;
        heap.push(t * 2);
        day++;
        if (sum > k)
        {
            cout << day - 1 << endl;
            break;
        }
    }
    return 0;
}